
define(function(require, exports, module){
	var popupImgTpl = require('{view}popupImg.tpl'),
		popupImgCss = require('{component}popupImg/popupImg.css'),
		defaults = {
			popupBox : '#popupImg',
			box:null
		},
		view = Backbone.View.extend({
			template: _.template(popupImgTpl)
		}),
		vView =new view,
		
	popupImg = {
		init : function(opts){
			this.popupBox = opts.popupBox;
			this.show()
			// this.bindEvt();
		},
		show:function(){
			var obj = {};
			obj.src = $(box).find('img').attr('src');

			if($(this.popupBox).length){
				return;
			}

			if($(box)[0].tagName == 'IMG' && $(box).size()>0){
				obj.src = $(box).attr('src');
			}else if($(box).find('img').size() <= 0){
				return;
			} 

			$('body').append(vView.template(obj))
			$(this.popupBox).on('tap',function(){
				$(this).addClass('zoomOutDown');
				// setTimeout(function(){
					this.remove();
				// },300)
			})
		},
		bindEvt:function(){
			// var This = this;

		}
	}

	$.fn.popupImg = function(options) {
		 box = this
	     opts = $.extend({}, defaults, options || {});	      
	     popupImg.init(opts);
	}

})